%s lexicon
%s header
%s body

ws [ \t]+
z {ws}?([0-9]*[.])?[0-9]+{ws}[0-9]+{ws}

plosive p|t|k|b|d|g
fricative f|s|S|v|z|Z|x
nasal m|n|J|N
liquid l|R
consonant {plosive}|{fricative}|{nasal}|{liquid}
glide w|H|j
semivowel {glide}
oralvowel i|e|E|a|A|O|o|u|y|2|9|@|6
nasalvowel e~|a~|o~|9~
vowel {oralvowel}|{nasalvowel}
marker [][*]|#V

%%

^signal{ws}        {/* This file is a waves label file */ 
                   BEGIN(header);}
<header>^\#{ws}?\n BEGIN(body);
<header>[^#]       /* don't printout rest of header */
<body>{z}          /*ignore time info */
<body>\n           /*ignore newline*/

^[^\\]/\\          {/* this file is a lexiconfile (delimiter='\') */ 
                   printf("Word----- %s -----\n",yytext);BEGIN(lexicon);}
<lexicon>\n.*/\\   printf("Word----- %s -----\n",yytext+1);
<lexicon>\\        /*ignore*/

\<[^>]*\>          printf("Extra          :\t%s\n",yytext);
{oralvowel}        printf("oralvowel      :\t%s\n",yytext);
{nasalvowel}       printf("nasalvowel     :\t%s\n",yytext);
{semivowel}        printf("semivowel      :\t%s\n",yytext);
{consonant}        printf("consonant      :\t%s\n",yytext);
{marker}           printf("Marker         :\t%s\n",yytext);
{ws}               printf("WordBoundary   :\t#\n");
\r?\n              /* ignore (cr)lf */
.                  printf("###Unknown###  :\t%s\n",yytext);

%%
main(argc, argv)
int argc;
char **argv;
{
  int i;

  ++argv; --argc; /* skip over program name */

  if(argc>0){
    for(i=0; i<argc; i++){
      yyin = fopen(argv[i],"r");
      if (yyin==NULL) 
        fprintf(stderr,"could not open %s --- skipped.\n",argv[i]);
      else {
        yylex();
      }
    }
  } else {
    yyin=stdin;
    yylex();
  }
}
